package com.xudow.app.dynamicstate_old.module.recommend;

import android.os.Bundle;
import android.support.annotation.NonNull;

import com.jude.beam.expansion.list.BeamListActivityPresenter;
import com.xudow.app.dynamicstate_old.data.DynamicModel;
import com.xudow.app.dynamicstate_old.domain.entity.RecommendTalent;

/**
 * Created by ske on 2016/6/11.
 */
public class PreferredTalentPresenter extends BeamListActivityPresenter<PreferredTalentActivity, RecommendTalent> {
    @Override
    protected void onCreate(@NonNull PreferredTalentActivity view, Bundle savedState) {
        super.onCreate(view, savedState);
        onRefresh();
    }

    @Override
    public void onRefresh() {
        DynamicModel.getInstance().getRecommentTalent(1, 10)
                .finallyDo(() -> setCurPage(2))
                .unsafeSubscribe(getRefreshSubscriber());
    }

    @Override
    public void onLoadMore() {
        DynamicModel.getInstance().getRecommentTalent(getCurPage(),10)
                .unsafeSubscribe(getMoreSubscriber());
    }
}
